﻿using System;
using Caliburn.Micro;
using SS.WPF.Framework.Display.Dialog;
using Action = System.Action;

namespace SS.WPF.Framework.Coroutines
{
    /// <summary>
    /// Expose components for an IResult
    /// </summary>
    public interface IFluentResult: IResult
    {
        /// <summary>
        /// Assign main action, it will be run on UI thread
        /// </summary>
        /// <param name="action"></param>
        IFluentResult Do(Action action);

        /// <summary>
        /// Assign an action that will be invoked to execute before main action executing,
        /// it will be run on UI thread
        /// </summary>
        /// <param name="action"></param>
        IFluentResult Before(Action action);

        /// <summary>
        /// Assign an action that will be invoked to execute after main action executing,
        /// it will be run on UI thread
        /// </summary>
        /// <param name="action"></param>
        IFluentResult After(Action action);

        /// <summary>
        /// Assign an action that will be invoked to execute when exception raised in main action
        /// </summary>
        /// <param name="action"></param>
        IFluentResult OnException(Action<Exception> action);

        /// <summary>
        /// Assign a callback for main action
        /// </summary>
        /// <param name="action"></param>
        IFluentResult OnCallback(Action action);

        /// <summary>
        /// Assign a value indicating whether ContinuousOnException.
        /// </summary>
        /// <param name="value"></param>
        IFluentResult ContinuousOnException(bool value);

        /// <summary>
        /// Assign title for a background action
        /// </summary>
        /// <param name="title">Title for a background action</param>
        IFluentResult Title(string title);

        /// <summary>
        /// Gets BlockingUI.
        /// </summary>
        IFluentResult BlockingUI();

        /// <summary>
        /// Set dialog manager
        /// </summary>
        /// <param name="dialogManager"></param>
        /// <returns></returns>
        IFluentResult DialogManager(IDialogManager dialogManager);
    }
}
